package com.qzxy.premiumhotelsystem.controller;

import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.qzxy.premiumhotelsystem.common.annotation.LogExecutionTime;
import com.qzxy.premiumhotelsystem.common.annotation.RateLimiter;
import com.qzxy.premiumhotelsystem.common.enums.LogLevel;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: iQNRen
 * @Description: 测试类
 * @Date: 2024/9/19 0:13 周四
 * @Version: 1.0
 */
@RestController
@Tag(name = "测试接口")
public class TestController {

    @Operation(summary = "hello")
    @GetMapping("/hello")
    @LogExecutionTime(message = "你好")
    @RateLimiter(time = 10,count = 3) // 限制每秒最多5次请求
    public String hello() {
        return "Hello, World!";
    }

    @Operation(summary = "hello1")
    @GetMapping("/hello1")
    @LogExecutionTime(operator = "xiaoli",message = "你好",level=LogLevel.DEBUG)
    public String hello2() {
        StpUtil.getLoginId();
        return "Hello1231, World!";
    }
}

